package solverStrategies;

import java.util.Map;
import java.util.Set;

import sudoku.SudokuEinzelfeld;
import sudoku.SudokuSpielfeld;
import sun.print.resources.serviceui;

public class BruteForce implements SolverAlgorithm {

	@Override
	public boolean manipulateSudoku(SudokuSpielfeld sf) {
		Map<Integer, Set<Integer>> poss = sf.getPossibleNumbers();
		Set<Integer> ids = poss.keySet();
		for (Integer id : ids) {
			SudokuEinzelfeld sef = sf.returnSinglefield(id);
			if (sef.getNumber() == 0) {
				Set<Integer> possNr = poss.get(id);
				sf.setNumberWithID(id,(Integer) possNr.toArray()[0], "BruteForce");
				return true;
			}
		}
		return false;
	}

	@Override
	public int returnLevel() {
		return 0;
	}

}
